package com.jt.service;

import com.jt.mapper.RightsMapper;
import com.jt.pojo.Rights;
import com.jt.vo.PageResult;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class RightsServiceImpl implements RightsService{
    @Autowired
    private RightsMapper rightsMapper;

    @Override
    public List<Rights> getRightsList() {
        //查询一级菜单parentId
        int parentId = 0;
       List<Rights > oneList =rightsMapper.findParentId(parentId);
       //查询每一级的二级
       for ( Rights oneRights : oneList){
           int oneId  =oneRights.getId();
           List<Rights> twoList =rightsMapper.findParentId(oneId);
           oneRights.setChildren(twoList);
       }

       return oneList;
    }

    @Override
    public List<Rights> getRightsList1() {
        List<Rights > oneList =rightsMapper.findParentId1();
        return oneList;
    }


}


